# 导入 selenium 包
from selenium import webdriver
from time import sleep

from selenium.webdriver.common.by import By
#
# driver = webdriver.Chrome()
# sleep(2)
# driver.get("http://www.baidu.com")
# sleep(2)
# 元素定位
# id
# driver.find_element(By.ID,"kw").send_keys("哪吒")
# name
# driver.find_element(By.NAME,"wd").send_keys("太白金星")
# class_name
# driver.find_element(By.CLASS_NAME,"s_ipt").send_keys("太白金星")
# tag_name
# driver.find_element(By.TAG_NAME,"input").send_keys("哪吒")
# 5.link_text
# driver.find_element(By.LINK_TEXT,"新").click()
# 6.part_link
# driver.find_element(By.PARTIAL_LINK_TEXT,"新").click()
# 7.xpath 路径
# driver.find_element(By.XPATH,'//*[@id="s-top-left"]/a[1]').click()
# sleep(2)
# 8.css选择器
# driver.find_element(By.CSS_SELECTOR,).send_keys("hello") #网页中没有css路径
# driver.quit()
# 操作命令
#  清除clear
# driver.find_element(By.ID,"kw").clear()
# 点击 submit
# driver.find_element(By.CSS_SELECTOR,"#su").submit()
# sleep(2)
#size 尺寸
print(driver.find_element(By.CSS_SELECTOR,"#su").size)
# text 属性
# aa = driver.find_element(By.LINK_TEXT,"新闻").text
# get_attribute()
aa = driver.find_element(By.ID,"su").get_attribute("value")
print(aa)
